import React, {Component, PropTypes} from 'react';

import classNames from 'classnames';

export default class  extends Component {
    constructor(props) {
        super(props);
        this.state = {
            checked:false
        }
    }

    componentWillMount(){
        if(this.props.storezore.indexOf(this.props.valuekey)>-1){
            this.setState({
                checked:true
            });
        }
    }

    onchose(checked){
        this.props.storechose(this.props.valuekey);
        this.setState({
            checked:!checked
        });
    }

    render() {
        const {item,onclick} = this.props,
            {checked} = this.state;
        return<div
                className={ classNames({ "ant-tag":true,"ant-tag-checkable":true,active:checked })  }
                onClick={this.onchose.bind(this,this.state.checked)}
            >{item.name}</div>
    }
}